class Solution {
public:
    int maxDepth(string s) {
        int ans = 0, max_ans = 0;
        for(int i = 0; i < s.length(); i++){
            if(s[i] == '('){
                ans++;
                max_ans = max(max_ans, ans);
            }
            else if(s[i] == ')')ans--;
        }
        return max_ans;
    }
};